package ezonsport.android.tools;

import java.util.Calendar;
import java.util.Date;
/**
 * 
 * @author ll
 * 日期工具类
 *
 */
public class DateUtil {
	//将日期保留到天，去除小时，分钟，秒和毫秒
	public static Date dateConvert(Calendar calendar){
		long timeInMil = calendar.getTimeInMillis();
		timeInMil = timeInMil - timeInMil%(24*3600*1000) - calendar.getTimeZone().getOffset(timeInMil);
		return new Date(timeInMil);
	}
	public static Date dateConvert(Date date){
		long timeInMil = date.getTime();
		timeInMil = timeInMil - timeInMil%(24*3600*1000);
		return new Date(timeInMil);
	}
	
	
	public static Date dateNewConvert(Date date){
		int year = date.getYear();
		int month = date.getMonth();
		int day = date.getDay();
		return new Date(year,month,day);
	}
}
